<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>注册</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../static/css/amazeui.min.css" />
<link href="../static/css/dlstyle.css" rel="stylesheet" type="text/css">
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/amazeui.min.js"></script>
</head>

<body>
<div class="login-boxtitle"> <a href="home/demo.html"><img alt="" src="../static/img/logobig.png" /></a> </div>
<div class="res-banner">
  <div class="res-main">
    <div class="login-banner-bg"><span></span><img src="../static/img/big.jpg" /></div>
    <div class="login-box">
      <div class="am-tabs" id="doc-my-tabs">
        <ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
          <li style="text-align:center">账号注册</li>
        </ul>
          <div class="am-tab-panel">
            <form method="post">
              <div class="user-name">
                <label for="code"><i class="am-icon-user"></i></label>
                <input type="text" name="" id="usercode" placeholder="请输入账号">
                </div>
              <div class="user-pass">
                <label for="password"><i class="am-icon-lock"></i></label>
                <input type="password" name="" id="password" placeholder="设置密码">
              </div>
              <div class="user-pass">
                <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
                <input type="password" name="" id="passwordRepeat" placeholder="确认密码">
              </div>
              <div class="user-phone">
                <label for="phone"><i class="am-icon-mobile-phone am-icon-md"></i></label>
                <input type="tel" name="" id="phone" placeholder="请输入手机号">
              </div>
            </form>
            <div class="login-links">
              <label for="reader-me">
                <input id="reader-me" type="checkbox">
                点击表示您同意商城《服务协议》 </label>
            </div>
            <div class="am-cf">
              <input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl" id="zhucecmf">
            </div>
            <hr>
            <div style="font-size:14px;color:#919191;text-align:center" id="todenglu">已有账号，立即登录</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="footer ">
      <div class="footer-hd">
        <p><img src="../static/img/duo.png" style="width:25px" />品类齐全<b>|</b><img src="../static/img/kuai.png" style="width:25px" />多仓直发<b>|</b><img src="../static/img/hao.png" style="width:25px" />正品行货<b>|</b><img src="../static/img/sheng.png" style="width:25px" />天天低价</p>
      </div>
      <div class="footer-bd "> </div>
    </div>
<script type="text/javascript">
var url_zhuce="/webserver/api/v1/user/";
var openid=getUrldata('OPENID');
var last=null;

$('#zhucecmf').click(function zhuce(){
	var url = "/webserver/api/v1/user/?format=json&openid="+openid;
	if(!$('#reader-me').is(':checked')){
		alert('尚未阅读用户服务与协议');
		return ;
	}
	
	var aa={};
	aa.openid=openid;
	aa.nickname=$('#usercode').val();
	if(aa.nickname.length<2){
		alert('用户名太短');
		return;
	}
	aa.password=$('#password').val();
	if(aa.password.length<6){
		alert('密码太短');
		return;
	}
	
	if(aa.password!=$('#passwordRepeat').val()){
		alert('俩次密码输入不一致');
		return;
	}
	if(aa.password.length!=6){
		alert('密码必须为6位数');
		return;
	}
	aa.telephone=$('#phone').val();
	if(aa.telephone.length!=11){
		alert('手机号不正确');
		return;
	}
	dopost(url_zhuce,aa,function(rs){
		console.log(rs);
		if(rs.id!=''&&rs.id!=undefined&&rs.id !=null&&rs.id !='null'){
			alert("注册成功");
			document.location.href=document.location.href;
		}
	});
}
);
$('#todenglu').click(function(){
	document.location.href="login_pc.html?OPENID="+openid;
});
</script>
</body>
</html>